package sctu.edu.java.year2016.team02.zhoujie.day20160601.chapter9_1; /**
 * Created by ACER on 2016/5/31.
 */
/*编写java程序，创建一个类，并在类中创建一个成员类部类，通过成员类部类计算1到任意数的和的操作，并在外部类中进行测试*/

import java.util.Scanner;

public class SumAll {

    public class inter {
        public void sumall()

        {
            int sum = 0;
            Scanner scanner = new Scanner(System.in);
            int x = scanner.nextInt();
            for (int a = 1; a < x + 1; a++) {
                sum += a;
            }
            System.out.println("1到" + x + "的和是：" + sum);
        }
    }

    public static void main(String[] args) {
        SumAll sum1 = new SumAll();
        inter s = sum1.new inter();
        s.sumall();
    }
}